﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using Toulr.Domains.System;
using Toulr.Domains.Account;

/// <summary>
/// 需要检测权限的页面
/// </summary>
public class LimitedPageBase : CommPageBase
{
    /// <summary>
    /// Initializes a new instance of the <see cref="PageBase"/> class.
    /// </summary>
    /// <Author>Tecky Lee</Author>
    /// <Date>2011/5/8 15:28</Date>
    public LimitedPageBase()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    /// <summary>
    /// Raises the <see cref="E:System.Web.UI.Page.PreInit"/> event at the beginning of page initialization.
    /// </summary>
    /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param>
    /// <Author>Tecky Lee</Author>
    /// <Date>2011/5/10 21:39</Date>
    protected override void OnPreInit(EventArgs e)
    {
        //检测页面权限
        if (!ValidatePopedom())
        {
            redirectDefaultPage();
        }
        else
        {
            base.OnInit(e);
        }
    }

    /// <summary>
    /// Redirects the default page.
    /// </summary>
    /// <Author>Tecky Lee</Author>
    /// <Date>2011/5/10 21:39</Date>
    private void redirectDefaultPage()
    {
        HttpContext.Current.Response.Redirect(PageHelper.Url("/default.aspx"));
    }

   

    /// <summary>
    /// Validates the popedom.
    /// </summary>
    /// <returns></returns>
    /// <Author>Tecky Lee</Author>
    /// <Date>2011/5/10 21:39</Date>
    public bool ValidatePopedom()
    {
        return true;
    }
}